home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11907 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: Why is C faster than FORTRAN?
  5. Date: 13 Mar 96 17:31:07 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.826738267@rscernix>
  8. References: <4hv2ho$d8t@news.interpath.net> <4i2c5e$t70@kiwi.futuris.net> <4i4poj$j7e@thorn.cc.usm.edu>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4i4poj$j7e@thorn.cc.usm.edu> sakalauk@coam.usm.edu (Peter Sakalaukus) writes:
  13.  
  14. >I have two programs, FORTRAN and C. They both use the same algorithm to
  15. >manipulate numeric data. The larger the data file though, the faster the
  16. >C version is, (in relation to the FORTARN program). I am running on a UNIX
  17. >platform. 
  18. >
  19. >My question is: what is the reason that C is so much quicker? 
  20.  
  21. Without seeing your code, nobody can tell.  Are you sure you've used
  22. comparable optimization levels?  Are the programs CPU or I/O bound?
  23.  
  24. >Is C normally faster than FORTRAN?
  25.  
  26. No.  Fortran is normally faster than C.  Fortran forbids data aliasing
  27. (behind compiler's back) and this allows more aggressive optimization,
  28. especially on code involving arrays.
  29.  
  30. Dan
  31. --
  32. Dan Pop
  33. CERN, CN Division
  34. Email: danpop@mail.cern.ch 
  35. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  36.